package sharedGameLogic.gameData;

import java.io.Serializable;

import sharedGameLogic.enums.BattleDistance;
import sharedGameLogic.enums.GameStatus;



/**
 * A class describing the result of a game round.
 * Each players new health and new energy is 
 * represented, what action each player did, if
 * their action succeeded and the new distance
 * the battle is in.
 * 
 * @author Sebastian
 */

public class BattleResult implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7886371437300901241L;

	private BattleDistance distance;
	
	private PlayerResult firstPlayer;
	private PlayerResult secondPlayer;
	
	private GameStatus gameStatus;
	
	
	/**
	 * Constructor asking for the parameters needed for the client to be 
	 * able to display the results of two players action
	 * 
	 * @param firstPlayer - The result of the first players actions
	 * @param secondPlayer - The result of the second players actions
	 */
	public BattleResult(PlayerResult firstPlayer, 
						PlayerResult secondPlayer, 
						BattleDistance distance,
						GameStatus status){
		
		this.firstPlayer = firstPlayer;
		this.secondPlayer = secondPlayer;
		this.gameStatus = status;
		
		//Cloning "distance", don't know how to do it else...
		if(distance == BattleDistance.CLOSE_COMBAT){
			this.distance = BattleDistance.CLOSE_COMBAT;
		}
		else if(distance == BattleDistance.DISTANCED_COMBAT){
			this.distance = BattleDistance.DISTANCED_COMBAT;
		}
	}
	
	/**
	 * Accessor method for the first players battle results.
	 * @return - firstPlayer
	 */
	public PlayerResult getFirstPlayer(){
		return firstPlayer;
	}
	
	/**
	 * Accessor method for the first players battle results.
	 * @return - secondPlayer
	 */
	public PlayerResult getSecondPlayer(){
		return secondPlayer;
	}
	
	/**
	 * Accessor method for the current distance the battle is fought at.
	 * @return - distance
	 */
	public BattleDistance getCurrentDistance(){
		return distance;
	}
	
	/**
	 * 
	 * @return
	 */
	public GameStatus getGameStatus(){
		return gameStatus;
	}
}
